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A+BgB,IAAI,GAAnChB,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAqCiB,GAAG,IAG5C,GAAAX,EAAAI,GAAA,EAAClB,EAAAA,CACC2B,SAAUnB,EAAQoB,kBAAkB,CACpCC,WAAY,aAA2BC,MAAA,CAAdtB,EAAQuB,KAAK,EACtCC,KAAMxB,EAAQwB,IAAI,CAClBC,SAAU,CACRb,MAAOZ,EAAQyB,QAAQ,CACvBC,OAAQ1B,MAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAS0B,MAAM,GAAf1B,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAiBE,MAAM,GAAvBF,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAyB2B,IAAI,CACrCC,WAAY5B,MAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAS0B,MAAM,GAAf1B,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,OAAAA,CAAAA,EAAAA,EAAiBE,MAAM,GAAvBF,KAAAA,IAAAA,EAAAA,KAAAA,EAAAA,EAAyBuB,KAAK,CAC1CM,KAAM1B,EAAY2B,kBAAkB,CAACC,KAAAA,EAzBnB,CACxBC,KAAM,UACNC,MAAO,OACPC,IAAK,UACLC,SAAU,KACZ,EAqBM,EACAjB,cAAelB,EAAQkB,aAAa,CACpCkB,kBAAmBpC,EAAQoC,iBAAiB,CAC5CC,QAAS,CACPC,gBAAiB,CACfC,aAAc,IAChB,EACAC,gBAAiB,CACf5B,MAAO,kBACT,EACA6B,aAAc,CACZC,KAAM,OACR,EACAC,WAAY,CACVC,KAAM,OACNC,YAAa,cACf,EACAC,sBAAuB,CACrBC,SAAU,kBACVnC,MAAO,uCACPoC,KAAM,6CACNC,iBAAkB,SACpB,CACF,MAIR","sources":["webpack://_N_E/?bae0","webpack://_N_E/./src/pages/articles/[slug].tsx","webpack://_N_E/<anon>"],"sourcesContent":["\n    (window.__NEXT_P = window.__NEXT_P || []).push([\n      \"/articles/[slug]\",\n      function () {\n        return require(\"private-next-pages/articles/[slug].tsx\");\n      }\n    ]);\n    if(module.hot) {\n      module.hot.dispose(function () {\n        window.__NEXT_P.push([\"/articles/[slug]\"])\n      });\n    }\n  ","import { contentful } from '@/component-library-lib/dataSource/contentful/client';\nimport { Topics } from '@/component-library-lib/dataSource/contentful/models/topics';\nimport Head from '@/components/templates/Head/Head';\nimport { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';\nimport dynamic from 'next/dynamic';\n\nconst ArticleTemplate = dynamic(\n  import('@/components/templates/ArticleTemplate/ArticleTemplate')\n);\n\n/** The props for the Custom Page */\nexport type ArticleProps = InferGetServerSidePropsType<\n  typeof getServerSideProps\n>;\n\n/**\n * A page that displays an article.\n *\n * @param {ArticleProps} props - The props of the Article Page Component.\n * @returns {React.FC<ArticleProps>} Article Page Component\n */\nconst ArticlePage = (props: ArticleProps) => {\n  const article = props.fields;\n  const displayDate = new Date(article.publishDate);\n  const dateFormatOptions = {\n    year: 'numeric',\n    month: 'long',\n    day: 'numeric',\n    timeZone: 'UTC',\n  } as const;\n\n  return (\n    <section className=\"mx-auto\" data-testid=\"article-page\">\n      <Head\n        title={article.title}\n        description={article.description}\n        image={\n          article.thumbnail?.fields?.file?.url ||\n          article.featuredImage?.fields?.file?.url\n        }\n      />\n      <ArticleTemplate\n        articles={article.acrossArticleCards}\n        articleUrl={`/articles/${article.slugs}`}\n        copy={article.copy}\n        headline={{\n          title: article.headline,\n          author: article?.author?.fields?.name,\n          authorLink: article?.author?.fields?.slugs,\n          date: displayDate.toLocaleDateString(undefined, dateFormatOptions),\n        }}\n        featuredImage={article.featuredImage}\n        hideFeaturedImage={article.hideFeaturedImage}\n        content={{\n          articleHeadline: {\n            authorPrefix: 'By',\n          },\n          articlesDisplay: {\n            title: 'Related Articles',\n          },\n          articleShare: {\n            text: 'Share',\n          },\n          breadCrumb: {\n            home: 'Home',\n            allArticles: 'All Articles',\n          },\n          fullWidthCalloutImage: {\n            overline: 'Petco Love Lost',\n            title: 'Always on - for when they wander off',\n            body: 'Sign up now in case they go missing later.',\n            signUpButtonText: 'Sign Up',\n          },\n        }}\n      />\n    </section>\n  );\n};\nexport default ArticlePage;\n\n/**\n * @param {object} context - The context object\n * @returns {object} - The props object\n */\nexport const getServerSideProps = async (\n  context: GetServerSidePropsContext<{\n    /** The locale */\n    locale?: string;\n    /** The slug */\n    slug: string;\n  }>\n) => {\n  const data = await contentful.withoutUnresolvableLinks.getEntries<\n    Topics['Article']\n  >({\n    content_type: 'article',\n    'fields.slugs': context.params?.slug,\n    locale: 'en-US',\n    include: 10,\n  });\n\n  /**\n   * Fixing circular reference error: The data structure of the article contains\n   * references to the `acrossArticleCards` that in turn contains references to\n   * the `acrossArticleCards` and so on. This was creating a circular reference\n   * between the items, which can lead to unexpected behavior and memory leaks.\n   * To fix the issue, we are assigning `null` to the `acrossArticleCards`\n   * property of each item in the array, if the array exists. This breaks the\n   * circular reference and prevents any potential issues.\n   */\n  if (data.items?.length > 0 && data.items[0]?.fields.acrossArticleCards) {\n    data.items[0].fields.acrossArticleCards.forEach((item) => {\n      if (item) {\n        item.fields.acrossArticleCards = [];\n      }\n    });\n  }\n\n  return {\n    notFound: !data.items.length,\n    props: {\n      ...data.items[0],\n    },\n  };\n};\n"],"names":["window","__NEXT_P","push","__webpack_require__","ArticleTemplate","dynamic","Promise","all","e","then","bind","__webpack_exports__","article","props","fields","displayDate","Date","publishDate","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsxs","section","className","jsx","Head","title","description","image","thumbnail","file","url","featuredImage","articles","acrossArticleCards","articleUrl","concat","slugs","copy","headline","author","name","authorLink","date","toLocaleDateString","undefined","year","month","day","timeZone","hideFeaturedImage","content","articleHeadline","authorPrefix","articlesDisplay","articleShare","text","breadCrumb","home","allArticles","fullWidthCalloutImage","overline","body","signUpButtonText"],"sourceRoot":""}